package org.scs.carleton.ca.pgdt.core.internal.parser;

import org.scs.carleton.ca.pgdt.core.parser.nodes.IASTArgument;
import org.scs.carleton.ca.pgdt.core.parser.nodes.IASTNode;
import org.scs.carleton.ca.pgdt.core.visitor.PrologVisitor;

/**
 * Physical implementation of a Prolog Argument.  External usage of tihs class is discouraged.
 * 
 * @author tessierj
 *
 */
public class ASTArgument extends ASTNode implements IASTArgument {
	private IASTNode wrappedNode;
	
	public ASTArgument(ASTTranslationUnit translationUnit, int type, IASTNode node) {
		super(translationUnit, type);
		wrappedNode = node;
	}

	@Override
	public IASTNode getWrappedNode() {
		return wrappedNode;
	}
	
	@SuppressWarnings("nls")
	public String toString() {
		return "Argument: " + " from " + getStartOffset() + " to " + getEndOffset();
	}

	@Override
	public boolean accept(PrologVisitor visitor) {
		boolean visitChildren = visitor.visit(this);
		
		if (visitor.visit(this)) {
			//If the visitor wants to visit this node...
			wrappedNode.accept(visitor);
		}
		
		return visitChildren;
	}
}
